package com.suke.czx.modules.info.entity;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.suke.czx.common.validate.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 应用模块名称: 信息
 * 代码描述: 信息实体
 * copyright: AUZAR ALL RIGHTS RESERVED
 * company: AUZAR
 *
 * @author: 颜米晨
 * @date: 2021/09/01 22:45
 */
@Data
@ApiModel(value = "信息管理")
@EqualsAndHashCode(callSuper = true)
public class Info extends Model<Info> {

    @ApiModelProperty(value = "信息id")
    @TableId(value = "info_id", type = IdType.AUTO)
    @NotNull(groups = {InfoUpdateGroup.class}, message = "信息编码不能为空")
    public Long infoId;

    @ApiModelProperty(value = "信息名称")
    @NotBlank(groups = {InfoSaveGroup.class, InfoUpdateGroup.class}, message = "信息名称不能为空")
    public String infoName;

    @ApiModelProperty(value = "信息内容")
    public String infoContent;

    @ApiModelProperty(value = "等级(1 普通、2 重要、3 特别重要)")
    @NotNull(groups = {InfoSaveGroup.class, InfoUpdateGroup.class}, message = "信息等级不能为空")
    @EnumValue(groups = {InfoSaveGroup.class, InfoUpdateGroup.class}, intValues = {1, 2, 3}, message = "信息等级只能是1,2,3")
    public Integer level;

    @TableField(exist = false)
    @ApiModelProperty(value = "等级名称")
    public String levelName;

    @ApiModelProperty(value = "状态(0 禁用、1 启用)")
    @NotNull(groups = {InfoSaveGroup.class, InfoUpdateGroup.class}, message = "信息状态不能为空")
    @EnumValue(groups = {InfoSaveGroup.class, InfoUpdateGroup.class}, intValues = {0, 1}, message = "信息状态只能是0,1")
    public Integer status;

    @TableField(exist = false)
    @ApiModelProperty(value = "状态名称")
    public String statusName;

    @ApiModelProperty(value = "有效起始日期")
    @NotNull(groups = {InfoSaveGroup.class, InfoUpdateGroup.class}, message = "有效起始日期不能为空")
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    public Date validBeginDate;

    @ApiModelProperty(value = "有效截止日期")
    @NotNull(groups = {InfoSaveGroup.class, InfoUpdateGroup.class}, message = "有效截止日期不能为空")
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    public Date validEndDate;

    @ApiModelProperty(value = "发布人编码")
    @NotNull(groups = {InfoSaveGroup.class, InfoUpdateGroup.class}, message = "发布人编码不能为空")
    public Long publisher;

    @TableField(exist = false)
    @ApiModelProperty(value = "发布人姓名")
    public String publisherName;

    @ApiModelProperty(value = "备注")
    public String note;

    @ApiModelProperty(value = "删除标记  0：删除   1：正常")
    public Integer del;

    @ApiModelProperty(value = "创建者id")
    public Long creator;

    @ApiModelProperty(value = "创建时间")
    public Date createTime;

    @ApiModelProperty(value = "更新者id")
    public Long updater;

    @TableField(exist = false)
    @ApiModelProperty(value = "更新人姓名")
    public String updaterName;

    @ApiModelProperty(value = "更新时间")
    public Date updateTime;

}
